/**********************************************************************************************************************
 * Copyright (c) Prophesee S.A.                                                                                       *
 *                                                                                                                    *
 * Licensed under the Apache License, Version 2.0 (the "License");                                                    *
 * you may not use this file except in compliance with the License.                                                   *
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0                                 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed   *
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.                      *
 * See the License for the specific language governing permissions and limitations under the License.                 *
 **********************************************************************************************************************/

// Data classes generated by psee_issd_convert.
// Parameters:
// issd_csv_format_version=1.0
// date=2021-09-06T19:34:45
// psee_issd_version=1.1.3.215+g40ab73918
// psee_sensor_lib_version=3.3.0.486+g1106e0921.d20210015
// issd_data_format_version=1.0

#ifndef METAVISION_HAL_ISSD_H
#define METAVISION_HAL_ISSD_H

#include <vector>

namespace Metavision {

enum class RegisterAction { N_A, READ, WRITE, WRITE_FIELD, DELAY };

class RegisterOperation {
public:
    RegisterAction action = RegisterAction::N_A;
    uint32_t address;
    uint32_t data;
    uint32_t mask;
    uint32_t usec;

    static RegisterOperation Write(uint32_t address, uint32_t data) {
        RegisterOperation op = RegisterOperation();
        op.action            = RegisterAction::WRITE;
        op.address           = address;
        op.data              = data;

        return op;
    }

    static RegisterOperation WriteField(uint32_t address, uint32_t data, uint32_t mask) {
        RegisterOperation op = RegisterOperation();
        op.action            = RegisterAction::WRITE_FIELD;
        op.address           = address;
        op.data              = data;
        op.mask              = mask;

        return op;
    }

    static RegisterOperation Delay(uint32_t usec) {
        RegisterOperation op = RegisterOperation();

        op.action = RegisterAction::DELAY;
        op.usec   = usec;

        return op;
    }

    static RegisterOperation Read(uint32_t address, uint32_t data, uint32_t mask) {
        RegisterOperation op = RegisterOperation();

        op.action  = RegisterAction::READ;
        op.address = address;
        op.data    = data;
        op.mask    = mask;

        return op;
    }

    static RegisterOperation Read(uint32_t address, uint32_t data) {
        RegisterOperation op = RegisterOperation();

        op.action  = RegisterAction::READ;
        op.address = address;
        op.data    = data;
        op.mask    = 0xFFFFFFFF;

        return op;
    }
};

struct Issd {
    const std::vector<RegisterOperation> init;
    const std::vector<RegisterOperation> start;
    const std::vector<RegisterOperation> stop;
    const std::vector<RegisterOperation> destroy;
};

} // namespace Metavision

#endif // METAVISION_HAL_ISSD_H